<?
layout("/inc/win_layout.html",{title:sysTitle}){
?>
<script type="text/javascript" src="static/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="static/utf8-jsp/ueditor.config.js"></script>
<script type="text/javascript" src="static/utf8-jsp/ueditor.all.js"></script>
<script type="text/javascript" src="static/utf8-jsp/lang/zh-cn/zh-cn.js"></script>


<link rel="stylesheet" href="static/uploadify/uploadify.css" type="text/css"></link>
<script type="text/javascript" src="static/uploadify/jquery.uploadify.min.js"></script>
<style>
	#tableactionTabContent .btn-default{
		margin-bottom: 15px;
	}
	#tableactionTabContent .btn-default.on{
		background: #086176;
    		color: #fff;
    		border-color: #064a59;
	}
	#tableactiondTab .btn-default.on{
		background: #086176;
    		color: #fff;
    		border-color: #064a59;
	}
	#tableactionTabContent{
		position: relative;
		/* height: 40px; */
		padding-top: 20px;
	}
	#tableactionTabContent .tab-pane{
		/* position: absolute; */
		left:52px;
		top:15px;
		float: right;
    	width: 94%;
	}
	#tableactionTabContent .tab-pane.fade{
		display:none;
	}
	#tableactionTabContent .tab-pane.fade.in{
		display:block;
	}
</style>
<div id="page-wrapper" style="margin-left: 0px;">
       
      <!--BEGIN CONTENT-->
       
       <div class="row" style="margin-left: 0px; margin-right: 0px; margin-top: 10px;" >
			<div class="col-lg-12">
				<div class="note note-danger">
					<h3 class="box-heading">${headline}</h3>
					<input type="hidden" value="${headline}" id="headline" name="headline" />
					<p>${describe}</p>
				</div>
			</div>
		</div>
		<?if(tableactiondTab != '' && tableactiondTab != null){?>
	   <div class="row" style="margin-bottom: 20px;">
	       <div class="col-lg-12">
          	 <!-- 分库分表 start  -->
	          		<div class="col-lg-12">
						<div id="tableactiondTab" >
							数据源：${tableactiondTab}
						</div>
                          <div id="tableactionTabContent">
                              	来源表：${tableactionTabContent}
                          </div>
                      </div>
               <!-- 分库分表 end  -->
		   </div>
	   </div> 
      <?}?>
		<!-- 知识分类e -->
		<div class="row" style="margin-left: 0px; margin-right: 0px; margin-top: -10px;">
			<div class="col-lg-12">
				<form action="addrelevance.do" method="post" enctype="multipart/form-data"  name="wsxForm" id="wsxForm" class="Huiform wsxForm"  >
					<div id="generalTabContent" class="tab-content responsive">
						<div id="dp-tab" class="tab-pane fade in active">
							<div class="row">
								<input type="hidden" value="${classesEn}" id="classesEn" name="classesEn" />
								<input type="hidden" value="${classesId}" name="classesId" id="classesId" />
								<input type="hidden" value="${serversPath}" name="serversPath" id="serversPath" />
								<input type="hidden" value="${subjectClassesEn}" id="subjectClassesEn" name="subjectClassesEn" />
								<input type="hidden" value="${idString}" name="idString" id="idString" />
								<input type="hidden" value="${clichId}" id="clichId" name="clichId" />
								<input type="hidden" value="${databaseName}" id="databaseId" name="databaseId" />
								<input type="hidden" value="${chartName}" id="tableName" name="tableName" />
								<input type="hidden" value="${targetDataSourceId}" id="targetDataSourceId" name="targetDataSourceId" />
								<input type="hidden" value="${targetTableName}" id="targetTableName" name="targetTableName" />
								<textarea id="uploadImage" name="uploadImage"></textarea>
								<?for( dataPropertiesName in dataProperties){?>
								<?if(dataPropertiesName.adminDetailShow == '1'){?>
								<!-- 文本框（分词） -->
								<?if(dataPropertiesName.dataTypeId == 3){?>
								<div class="col-lg-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
										</label>
										<input id="${dataPropertiesName.nameEn}" type="text" class="form-control" name="${dataPropertiesName.nameEn}" 
										<?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
										/>
									</div>
								</div>
								<?}?>
								<!-- 文本框（不分词） -->
								<?if(dataPropertiesName.dataTypeId == 2){?>
								<div class="col-lg-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
										</label>
										<input id=${dataPropertiesName.nameEn} type="text" class="form-control" onchange="verify(this.value,this.name)"  name="${dataPropertiesName.nameEn}" 
											<?if(dataPropertiesName.formValidationRegulation !=''){?>
												datatype="${dataPropertiesName.formValidationRegulation}"
											<?} else {?>
												ignore="ignore"
											<?}?>
											/>
									</div>
								</div>
								<?}?>
								<!-- 金额 -->
								<?if(dataPropertiesName.dataTypeId == 21){?>
								<div class="col-lg-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
										</label>
										<input id=${dataPropertiesName.nameEn} type="text" class="form-control" onchange="verify(this.value,this.name)"  name="${dataPropertiesName.nameEn}" 
											<?if(dataPropertiesName.formValidationRegulation !=''){?>
												datatype="${dataPropertiesName.formValidationRegulation}"
											<?} else {?>
												ignore="ignore"
											<?}?>
											/>
									</div>
								</div>
								<?}?>
								<!-- 密码 -->
								<?if(dataPropertiesName.dataTypeId == 14){ ?>
								<div class="col-lg-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
										</label>
										<input id="${dataPropertiesName.nameEn}" type="password" class="form-control" name="${dataPropertiesName.nameEn}" 
										<?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
										/>
									</div>
								</div>
								<?}?>									
									
								<!-- 文本域 -->
								<?if(dataPropertiesName.dataTypeId ==4){?>
								<div class="col-md-12">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
										</label>
										<textarea id=${dataPropertiesName.nameEn} rows="4" class="form-control" name=${dataPropertiesName.nameEn}  
											<?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
										
										></textarea>
									</div>
								</div>
								<?}?>

								<!-- HTML（大区域） -->
								<?if(dataPropertiesName.dataTypeId ==6){?>
								<div class="col-md-12">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
										<?} ?></label>
										<script id="${dataPropertiesName.nameEn}" name="${dataPropertiesName.nameEn}" type="text/plain" ></script>

										<script type="text/javascript" >
											var ue = UE.getEditor('${dataPropertiesName.nameEn}',{ initialFrameHeight:300 });
										</script>
									</div>
								</div>
								<?}?>
								<!-- HTML（小区域） -->
								<?if(dataPropertiesName.dataTypeId == 5){?>
								<div class="col-md-6">
									<div class="form-group" >
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
										<?} ?></label>
										<script id="${dataPropertiesName.nameEn}" name="${dataPropertiesName.nameEn}" type="text/plain" ></script>

										<script type="text/javascript" >
											var ue = UE.getEditor('${dataPropertiesName.nameEn}',{ initialFrameHeight:200 ,
											toolbars: [
												['undo', 'redo','|', 'bold', 'italic','underline','|','paragraph','fontfamily',
													'fontsize','forecolor','|', 'justifyleft','justifyright','justifycenter','justifyjustify',
													'|','removeformat','formatmatch','|','rowspacingtop','rowspacingbottom','lineheight','insertorderedlist','insertunorderedlist'
												]
											 ]
											});
										</script>
									</div>
								</div>
								<?}?>

								<!-- 下拉菜单（单值） -->
								<?if(dataPropertiesName.dataTypeId == 7){?>
								<div class="col-md-6">
								<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
								<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
								</label><br/>
									 <input id="dataPropertiesId" name="dataPropertiesId" type="hidden" value=${dataPropertiesName.id} /> 
									<div class="form-group">
									<?for( dMap in dictsMap){?>
									<?if(dataPropertiesName.dictId == dMap.key){ ?>
									<?if(dMap.value == 1){ ?>
										<select class="form-control" id="${dataPropertiesName.id}" name="${dataPropertiesName.nameEn}" 
										<?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
										
										>
											<option value=''>--请选择--</option>
											<?for(res in resultString){?>
												<?if(res.dpid==dataPropertiesName.id){?>
													<option value="${res.value}">${res.nameZh}</option>
												<?}?>
											<?}?>
										</select>
										<?} else { ?>
											<div class="input-group input-group-sm mbs">
											<input id="dictitemName_${dataPropertiesName.id}" type="text" placeholder="请点击选择" class="form-control" disabled="true" />
											
											 <span class="input-group-btn">
											 	<button id="t_${dataPropertiesName.id}" onclick="saveEditZTree('${dataPropertiesName.dictId}','${dataPropertiesName.id}')" type="button" data-toggle="dropdown"
													class="btn btn-success dropdown-toggle">选择类..</button>
											</span>
											<input name="${dataPropertiesName.nameEn}" id="dictitemId_${dataPropertiesName.id}" type="hidden" class="form-control" 
											
											 <?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
										/>
									</div>
										<?}}}?>
										
									</div>
								</div>
								<?}?>
								<!-- 下拉菜单（多值） -->
								<?if(dataPropertiesName.dataTypeId == 20){?>
								<div class="col-md-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
										<?} ?>
										</label><br/>
											<div class="input-group input-group-sm mbs">
											<input id="dictitemName_${dataPropertiesName.id}" type="text" placeholder="请点击选择" class="form-control" disabled="true" />
											 <span class="input-group-btn">
											 	<button id="t_${dataPropertiesName.id}" onclick="multiEditZTree('${dataPropertiesName.dictId}','${dataPropertiesName.id}')" type="button" data-toggle="dropdown"
													class="btn btn-success dropdown-toggle">选择类..</button>
											</span>
											<input name="${dataPropertiesName.nameEn}" id="dictitemId_${dataPropertiesName.id}" type="hidden" class="form-control" 
											
											 <?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
										/>
									</div>
									</div>
								</div>
								<?}?>

								<!-- 上传图片（单个） -->
								<?if(dataPropertiesName.dataTypeId == 8){?>
								<div class="col-md-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
										</label><br/>
											<div style= "display:inline " id="single_${dataPropertiesName.id}"></div>
										 	<input type="button" onclick="upImages('${dataPropertiesName.id}',1)"  class="btn btn-primary" value="选择图片"  title="只可上传单个图片，如有多个以最后一个为准"/>
   											<input type="button" onclick="deleteImages('${dataPropertiesName.id}')"  class="btn btn-default dropdown-toggle" value="删除图片"  />
   											<input type="hidden" id="singlePhone_${dataPropertiesName.id}"  /> 
   											<input type="hidden" name=${dataPropertiesName.nameEn} id="onePhone_${dataPropertiesName.id}" 
   											<?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
   											/> 
   												
									</div>
								</div>
								<?}?>

								<!-- 上传图片（多个） -->
								<?if(dataPropertiesName.dataTypeId == 26){?>
								<div class="col-md-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
										<?} ?>
										</label><br/>
                 						 <div style= "display:inline " id="single_${dataPropertiesName.id}"></div>
										 	<input type="button" onclick="upImages('${dataPropertiesName.id}',2)"  class="btn btn-primary"  value="选择图片" title="可上传多个图片" />
										 	<input type="button" onclick="deleteImages('${dataPropertiesName.id}')"  class="btn btn-default dropdown-toggle" value="删除图片"  />
   											<input type="hidden" id="singlePhone_${dataPropertiesName.id}"  /> 
   											<input type="hidden" name=${dataPropertiesName.nameEn} id="onePhone_${dataPropertiesName.id}" 
   											<?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
   											/> 
                 						  
									</div>
								</div>
								<?}?>

								<!-- 上传附件（单个） -->
								<?if(dataPropertiesName.dataTypeId == 16 || dataPropertiesName.dataTypeId == 24|| dataPropertiesName.dataTypeId == 25){?>
								<div class="col-md-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
										<?} ?>
										</label><br/>
										<div style= "display:inline " id="showone_${dataPropertiesName.id}"></div>
										<input type="button" onclick="upFiles('${dataPropertiesName.id}','1')"  class="btn btn-primary" value="选择文件" title="只可上传单个文件，如有多个以最后一个为准" />
   										<input type="button" onclick="deletefileone('${dataPropertiesName.id}')"  class="btn btn-default dropdown-toggle" value="删除文件"  />
   										<input type="hidden" id="singleAdjunctname_${dataPropertiesName.id}" name="${dataPropertiesName.nameEn}" value=""/>
									</div>
								</div>
								<?}?>

								<!-- 上传附件（多个） -->
								<?if(dataPropertiesName.dataTypeId == 17){?>
								<div class="col-md-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
										<?} ?>
										</label><br/>
										<div style= "display:inline " id="showmuch_${dataPropertiesName.id}"></div>
										<input type="button" onclick="upFiles('${dataPropertiesName.id}','2')"  class="btn btn-primary" value="选择文件"  />
   										<input type="button" onclick="deletefilemuch('${dataPropertiesName.id}')"  class="btn btn-default dropdown-toggle" value="删除文件"  />
   										<input type="hidden" id="singleAdjunctmuch_${dataPropertiesName.id}" name="${dataPropertiesName.nameEn}" value=""/>
									</div>
								</div>
								<?}?>
								<!-- 文件转pdf -->
								<?if(dataPropertiesName.dataTypeId == 27){?>
								<div class="col-md-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
										<?} ?>
										</label><br/>
										<div style= "display:inline " id="showmuch_${dataPropertiesName.id}"></div>
										<input type="button" onclick="upFiles('${dataPropertiesName.id}','3')"  class="btn btn-primary" value="选择文件"  />
   										<input type="button" onclick="deletefilemuch('${dataPropertiesName.id}')"  class="btn btn-default dropdown-toggle" value="删除文件"  />
   										<input type="hidden" id="singleAdjunctmuch_${dataPropertiesName.id}" name="${dataPropertiesName.nameEn}" value=""/>
									</div>
								</div>
								<?}?>

								<!-- 数值 -->
								<?if(dataPropertiesName.dataTypeId == 9){?>
								<div class="col-md-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
										</label>
										<input id=${dataPropertiesName.nameEn} type="text" class="form-control" name=${dataPropertiesName.nameEn}
										 <?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
										 
										 />
									</div>
								</div>
								<?}?>
								<!-- 阿里云上传 -->
								<?if(dataPropertiesName.dataTypeId == 22){?>
								<div class="col-md-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
										<?} ?>
										</label><br/>
											<div class="input-group input-group-sm mbs">
											<input id="dictitemName_${dataPropertiesName.id}" type="text" placeholder="请点击选择" class="form-control" disabled="true" />
											 <span class="input-group-btn">
											 	<button id="t_${dataPropertiesName.id}" onclick="aliyunUploading('${dataPropertiesName.id}')" type="button" data-toggle="dropdown" class="btn btn-success dropdown-toggle">选择文..</button>
											</span>
											<input name="${dataPropertiesName.nameEn}" id="dictitemId_${dataPropertiesName.id}" type="hidden" class="form-control" 
											
											 <?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
										/>
									</div>
									</div>
								</div>
								<?}?>
								<!-- 超级链接-->
								<?if(dataPropertiesName.dataTypeId == 23){?>
								<div class="col-lg-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
										</label>
										<input id=${dataPropertiesName.nameEn} type="text" class="form-control" name="${dataPropertiesName.nameEn}" 
											<?if(dataPropertiesName.formValidationRegulation !=''){?>
												datatype="${dataPropertiesName.formValidationRegulation}"
											<?} else {?>
												ignore="ignore"
											<?}?>
											/>
									</div>
								</div>
								<?}?>
								<!-- 日期（年） -->
								<?if(dataPropertiesName.dataTypeId == 10){?>
								<div class="col-md-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
										</label>
										<input id=${dataPropertiesName.nameEn} type="text" onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy'})"
											 class="form-control"  name=${dataPropertiesName.nameEn} 
											 <?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
											 /> 
									</div>
								</div>
								<?}?>

								<!-- 日期（年-月） -->
								<?if(dataPropertiesName.dataTypeId == 11){?>
								<div class="col-md-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
										</label>
										<input id=${dataPropertiesName.nameEn} type="text" onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM'})"
											class="form-control"  name=${dataPropertiesName.nameEn} 
											<?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
											/>
									</div>
								</div>
								<?}?>

								<!-- 日期（年-月-日） -->
								<?if(dataPropertiesName.dataTypeId == 12){?>
								<div class="col-md-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
										</label>
										<input id=${dataPropertiesName.nameEn} type="text" onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})"
											class="form-control"  name=${dataPropertiesName.nameEn} 
											<?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
											/>
									</div>
								</div>
								<?}?>

								<!-- 日期（年-月-日 时-分-秒） -->
								<?if(dataPropertiesName.dataTypeId ==13){?>
								<div class="col-md-6">
									<div class="form-group">
										<label for="inputPhone" class="control-label">${dataPropertiesName.nameZh}
										<?if(dataPropertiesName.formValidationRegulation == '*'){?>
												<span class='require'>*</span>
											<?} ?>
										</label>
										<input id=${dataPropertiesName.nameEn} type="text" onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss'})"
											class="form-control"  name=${dataPropertiesName.nameEn} 
											<?if(dataPropertiesName.formValidationRegulation !=''){?>
											datatype="${dataPropertiesName.formValidationRegulation}"
										<?} else {?>
											ignore="ignore"
										<?}?>
											/>
									</div>
								</div>
								<?}?>

								<?}?>
								<?}?>
							</div>
						  </div>
						<!-- <input type="button" onclick="" value="保存" class="btn btn-primary" /> -->
						</div>
					</div>
			</form>
			<div id="photos" style="display: none;text-align:center;margin:0 auto;">
			</div>
		</div>
		
		
                     
      <!--END CONTENT-->
</div>
    
  
<?} ?>


<script type="text/javascript">

var dictId ;
var relevances;
var oncid;
var oncliDataId;
var multiDictId;
var multiId;
function getdictIdZTree(){
	return dictId
}
function getoncliDataId(){
	return oncliDataId;
}
function getmultiDictId(){
	return multiDictId;
}
function getmultiId(){
	return multiId;
}


$(document).ready(function () { 
	$('#tableactiondTab').on('click','.btn-default',function(){
		var index=$(this).index();
		$(this).addClass('on').siblings().removeClass('on');
		$('#tableactionTabContent').find('.btn-default').removeClass('on');
		$('#tableactionTabContent .tab-pane').eq(index).find('.btn-default').eq(0).addClass('on');
		$('#tableactionTabContent .tab-pane').removeClass('in active');
		$('#tableactionTabContent .tab-pane').eq(index).addClass('in active');
		$("#targetDataSourceId").val($("#tableactiondTab input.on").attr("data-value"));
		$("#targetTableName").val($("#tableactionTabContent input.on").attr("data-value"));
	});
	
	$('#tableactionTabContent').on('click','.btn-default',function(){
		$(this).addClass('on').siblings().removeClass('on');
		$("#targetDataSourceId").val($("#tableactiondTab input.on").attr("data-value"));
		$("#targetTableName").val($("#tableactionTabContent input.on").attr("data-value"));
	});
	
});


	function saveEditZTree(id,oncliId) {
		dictId=id;
		oncliDataId =oncliId;
		parent.layer.open({
			type : 2,
			area : [ '510px', '500px' ],
			fix : false, //不固定
			//maxmin : true,
			scrollbar : false,
			shadeClose : true,
			title : '字典项管理',
			btn : [ '保存 ', '关闭' ],
			skin : 'layui-layer-rim', //加上边框
			content : ["knowledge-edit-data-relevanceztree.html?winName="+window.name,'no'],
			yes : function(index, layer) {
				//alert(index);
				var iframeWin = parent.window[layer.find('iframe')[0]['name']];
				//alert(iframeWin);
				iframeWin.queren();
			},
			cancel : function(index) {
			}
		});
	};


	//所属  字典类Id
	//树状结构
	
	var did = null; 
	var number = null;
	
	function getlay() {  
            return did;
    }
    
	function getnumber() {  
            return number;
    }
	
	function initTree(id) {
	did = id;
	var nameEn = $("#classesEn").val();
		$.ajax({
			type : "post",
			data : {
			"did" : did,
			"nameEn" : nameEn,
			},
			url : "knowledge-edit-data-detail-ajax.html",
			dataType : "json",
			beforeSend : function(XMLHttpRequest) {},
			success : drawTree,
		});
	}
	var setting = {
			check: {
				enable: true,
				chkboxType: {"Y":"", "N":""}
			},
			view: {
				dblClickExpand: false
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				beforeClick: beforeClick,
				onCheck: onCheck
			}
		};
	function drawTree(data) {
		var zNodes = eval(data);
		$.fn.zTree.init($("#"+did), setting, zNodes).expandAll(true);
		showMenu();
		/* alert(JSON.stringify(zNodes)); */
	}
	
	function beforeClick(treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj(did);
		zTree.checkNode(treeNode, !treeNode.checked, null, true);
		return false;
	}
		
	function onCheck(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj(did),
			nodes = zTree.getCheckedNodes(true),
			v = "";
			for (var i=0, l=nodes.length; i<l; i++) {
				v += nodes[i].name + ",";
			}
			if (v.length > 0 ) v = v.substring(0, v.length-1);
			var cityObj = $("#citySel_"+did);
			cityObj.attr("value", v);
		}

		function showMenu() {
		
			var cityObj = $("#citySel_"+did);
			var cityOffset = $("#citySel_"+did).offset();
			$("#menuContent_"+did).css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");

			$("body").bind("mousedown", onBodyDown);
		}
		function hideMenu() {
			$("#menuContent_"+did).fadeOut("fast");
			$("body").unbind("mousedown", onBodyDown);
		}
		function onBodyDown(event) {
			if (!(event.target.id == "menuBtn_"+did || event.target.id == "citySel_"+did || event.target.id == "menuContent_"+did || $(event.target).parents("#menuContent_"+did).length>0)) {
				hideMenu();
			}
		}
	
	
	 //验证
var wsxForm;
var imagePathId;
var _editor;
var filesPathId;
var filesCount;
var imagesPathType;
$(function(){
	wsxForm = $(".wsxForm").Validform({
		tiptype:1,
		tipSweep:true
	});
	
	_editor = UE.getEditor('uploadImage');
	    _editor.ready(function (){
	        //设置编辑器不可用(事实上不可以设置不可用...所以注释掉,以观后效)
	        _editor.setDisabled();
	        //隐藏编辑器,因为只使用上传功能
	        _editor.hide();
	        //侦听图片上传
	  	 	_editor.addListener('beforeInsertImage',function(t,arg){
	  	 		if(imagesPathType == '1' ){
	  	 			for(var i=0;i<arg.length;i++){
	  	 				var urlPath = arg[i].src;
	  	 				$("#single_"+imagePathId).html('<a href="javascript:querypicture('+imagePathId+')" ><img src='+urlPath+' width="30" height="30"/></a>');
	  	 				 $("#onePhone_"+imagePathId).val(urlPath);
	  	 				 $("#singlePhone_"+imagePathId).val(urlPath);
	  	 			}
	  	 		}else if(imagesPathType == '2'){
	  	 			var singleValue= '';
	  	 			var onePhoneValue= '';
	  	 			var singlePhoneValue= '';
	  	 			for(var i=0;i<arg.length;i++){
	  	 				var urlPath = arg[i].src;
	  	 				singleValue +='<a href="javascript:querypicture(\''+urlPath+'\')" ><img src='+urlPath+' width="30" height="30"/></a>;';
	  	 				onePhoneValue +=urlPath+';';
	  	 				singlePhoneValue +=urlPath+';';
	  	 			}
	  	 			$("#single_"+imagePathId).html(singleValue);
 	 				 $("#onePhone_"+imagePathId).val(onePhoneValue);
 	 				 $("#singlePhone_"+imagePathId).val(singlePhoneValue);
	  	 		}
	        });
	         //侦听文件上传
		   	 _editor.addListener('afterUpfile',function(t,arg){
		   	 	for(var i=0;i<arg.length;i++){
	  	 			var urlFile = arg[i].url;
	  	 			if(filesCount == '1'){
			            $("#singleAdjunctname_"+filesPathId).val(urlFile),
			          	$("#showone_"+filesPathId).html("<a href="+urlFile+" download='w3logo'><img src='static/images/wj.jpg' width='30' height='30' /></a>");
	  	 			}
	  	 			if(filesCount == '2'){
	  	 				 $("#singleAdjunctmuch_"+filesPathId).val(urlFile+"%"+ $("#singleAdjunctmuch_"+filesPathId).val());
						 $("#showmuch_"+filesPathId).append("<a href="+urlFile+" download='w3logo' title='点击下载'><img src='static/images/wj.jpg' width='30' height='30' /></a>");
	  	 			}
	  	 			if(filesCount == '3'){
			            $("#singleAdjunctmuch_"+filesPathId).val(urlFile);
			          	$("#showmuch_"+filesPathId).html("<a href="+urlFile+" target='_blank' download='w3logo'><img src='static/images/wj.jpg' width='30' height='30' /></a>");
			          	$.ajax({
							type : "post",
							data : {
								"urlFile" : urlFile,
							},
							url : "fileToPdf.do",
							dataType : "json",
							traditional : true,
							beforeSend : function(XMLHttpRequest) {},
							success : function(data){
								 $("#singleAdjunctmuch_"+filesPathId).val($("#singleAdjunctmuch_"+filesPathId).val()+"∷"+data);
						         $("#showmuch_"+filesPathId).html($("#showmuch_"+filesPathId).html()+"&nbsp;&nbsp;<a href="+data+" target='_blank' download='w3logo'><img src='static/images/wj.jpg' width='30' height='30' /></a>");
							},
						});
	  	 			}
	  	 		}
		   	 });
	   });
});
	//上传图片
	function upImages(imagesId,imagesType) {
		imagePathId = imagesId;
		imagesPathType = imagesType;
		var myFiles = _editor.getDialog("insertimage");
	  		myFiles.open();
	   
	}
	 //上传文件
	function upFiles(filesId,filesMuch) {
		filesPathId = filesId;
		filesCount = filesMuch;
		var myFiles = _editor.getDialog("attachment");
	   	myFiles.open();
	}
function submitForm() {
	// wsxForm.submitForm(false);
	wsxForm.ajaxPost(false);
	 setTimeout(function () { 
	 	if(wsxForm.getStatus() == "posting"){
		var index = parent.layer.getFrameIndex(window.name); 
			//window.parent.addQueryrelevance();
			window.parent.queryselectText(1);
	 		parent.layer.msg('添加成功！');
 			parent.layer.close(index);
		}
	 }, 1000);
	
}
/* function save(){
		 $.ajax({
			cache: true,
			type: "POST",
			url:"addrelevance.do",
			data:$('#wsxForm').serialize(),// 你的formid
			async: false,
			success: function(request) {
					var index = parent.layer.getFrameIndex(window.name); 
					window.parent.queryselectText();
			 		parent.layer.msg('添加成功！');
		 			parent.layer.close(index);                
			 } 
		}); 

	} */
	
	function querypicture(inagesUrl){
		var singph = $("#singlePhone_"+inagesUrl).val();
		$('#photos').html("<img src=\""+singph+"\" style='height: auto;max-height: 300px;' />");
		var index=layer.open({
		  type: 1,
		  title: false,
		  closeBtn: 1,
		  area: ['auto','auto'],
		  skin: 'layui-layer-nobg', //没有背景色
		  shadeClose: true,
		  content: $('#photos')
		});
		layer.iframeAuto(index);
	}
	//为客户资料时验证
	function verify(verifyValue,key){
		var headline = $("#headline").val();
		if(headline == '客户资料'){
			if(key == 'xingMing' || key == 'shouJi' || key == 'xing_ming' || key == 'shou_ji'){
				$.ajax({
					type : "post",
					data : {
						"key" : key,
						"value" : verifyValue,
						"classesEn" : $("#classesEn").val(),
					},
					url : "verifyValue.do",
					dataType : "json",
					traditional : true,
					beforeSend : function(XMLHttpRequest) {},
					success : function(data){
						if(data != '0'){
							layer.msg('已存在，请重新输出！');
							$("#"+key).val("");
						}
					},
				});
			}
		}
	}
	//多选
	function multiEditZTree(multiDict,multi){
		multiDictId=multiDict;
		multiId=multi;
		parent.layer.open({
			type : 2,
			area : [ '510px', '500px' ],
			fix : false, //不固定
			//maxmin : true,
			scrollbar : false,
			shadeClose : true,
			title : '字典项管理',
			btn : [ '保存 ', '关闭' ],
			skin : 'layui-layer-rim', //加上边框
			content : ["knowledge-edit-data-relevancemultiztree.html?winName="+window.name,'no'],
			yes : function(index, layer) {
				//alert(index);
				var iframeWin = parent.window[layer.find('iframe')[0]['name']];
				//alert(iframeWin);
				iframeWin.queren();
			},
			cancel : function(index) {
			}
		});
	}
	var aliyunValue;
	function getaliyunId(){
		return aliyunValue;
	}
	var aliyunUploadingData='';
	function getAliyunUploadingData(){
		return aliyunUploadingData;
	}
	//阿里云上传
	function aliyunUploading(aliyunId){
		aliyunValue=aliyunId;
		aliyunUploadingData = $("#dictitemId_"+aliyunId).val();
		parent.layer.open({
			type : 2,
			area : [ '800px', '530px' ],
			fix : false, //不固定
			maxmin : true,
			scrollbar : false,
			shadeClose : true,
			title : '阿里云上传',
			btn : [ '保存 ', '关闭' ],
			skin : 'layui-layer-rim', //加上边框
			content : ["knowledge-edit-aliyun-relevance-uploading.html?winName="+window.name,'no'],
			yes : function(index, layer) {
				 var iframeWin = parent.window[layer.find('iframe')[0]['name']];
				iframeWin.queren();
			},
			cancel : function(index) {
			}
		});
	}
	//删除图片
	function deleteImages(delimpId){
		$("#single_"+delimpId).html("");
		$("#singlePhone_"+delimpId).val("");
		$("#onePhone_"+delimpId).val("");
	}
	//删除文件
	function deletefileone(delimpId){
		$("#showone_"+delimpId).html("");
		$("#singleAdjunctname_"+delimpId).val("");
	}
	//删除文件
	function deletefilemuch(delimpId){
		$("#showmuch_"+delimpId).html("");
		$("#singleAdjunctmuch_"+delimpId).val("");
	}
</script>

